Object3D Class
A drawable 3D object type with zero or more shapes. Each shape can represent the contents of a 3DMF file.
More information available in parent classes: Element3D:Object
For use in an RB3DSpace control.
Notes
This is the basic three-dimensional object type. For information about the 3D Metafile format used to create 3DMF objects used in Rb3DSpace, see:
http://developer.apple.com/documentation/QuickTime/QD3D/qd3dmetafile.htm
An Object3D has a position, an orientation, and it may have multiple geometry models. Use AddShapeFromString to load a model from 3DMF data in a string, or use AddShapePicture to create a flat, rectangular model from a REALbasic picture, with white pixels appearing transparent. The scale parameter determines the size of the model in 3D space; a scale of 1.0 means that each pixel in the picture is 1 unit across in 3D space. You can change its position and orientation by directly modifying its properties, or you can use the Roll, Pitch, and Yaw methods to rotate the object, and MoveForward to move it in whatever direction it's facing (considered to be the +Z direction initially).
You can change its scale by modifying the Scale property; this defaults to 1.0. If you need more than one copy of an object in the game (as is often the case), use the Clone method which returns a new object that shares the same geometry as the original. Because the geometry is shared, this is much more economical than loading separate, duplicate copies of the model.
Example
The following loads a 3DMF object from an external ,3DMF file. This file type is declared in the File Types Set "FileTypes1".
Dim obj As Object3D
//allow only 3DMF files types to be shown
f = GetOpenFolderItem(FileTypes1.All)
If f <> Nil then
// create an object
obj = New Object3D
// give the object a shape specified by the 3DMF
obj.AddShapeFromFile f
If obj.Shapecount < 0 then
MsgBox "No valid 3DMF data found in "+.DisplayName+"."
Return
End if
// add the object to this Rb3DSpace
Me.objects.Append obj
End if
See Also
Bounds3D, ColorList, Element3D, Group3D, Light3D, Material, Quaternion, TriangleList, Trimesh, UVList, Vector3D, VectorList classes; RB3DSpace control.